<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <% 
String path = request.getContextPath(); 
// 获得项目完全路径（假设你的项目叫MyApp，那么获得到的地址就是 http://localhost:8080/MyApp/）: 
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 
%> 
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>"> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="用户登录">
<meta name="author" content="xwj">
<title>登录</title>
<link rel="stylesheet" href="css/user_css/css/bootstrap.min.css" />
        <link rel="stylesheet" href="css/user_css/css/font-awesome.min.css" />
        <!-- Custom CSS -->
        <link href="public_user/style.css" rel="stylesheet">
        
            <!-- 重置文件 -->
  <link rel="stylesheet" href="css/user_css/css/register/css/normalize.css">
  <link rel="stylesheet" href="css/user_css/css/register/css/style.css">
  <link rel="stylesheet" type="text/css" href="jsutil/sweetalert.css">
  <script src="jsutil/sweetalert.min.js"></script> 
  <script>
//注册用户
	function login() {
	
		$.ajax({
			url : 'userMsg/login.do',
			type : 'POST',
			async : "true",
			data : $('#login_form').serialize(),
			dataType : 'json',
			success : function(data) {
				if(data.res==0){
					alert("账号被禁用！");
				}
				else if (data.res == 1) {
					//sweetAlert("成功", "操作成功!", "success"); 
					alert("登录成功");
					window.location.replace("public_user/index.jsp");
				}else{
					alert("登录失败");
					//sweetAlert("登录失败", "用户名或密码错误", "error");
				}
			}
		});
		}
  </script>
</head>
<body>
<!--header start-->
     <%@include file="header.jsp"%>
      <!--header end-->
        
          <div class="login_main">
       <div class="login_div">
      <div class="p_div"><p>用户登录</p></div>
	<form class="form-horizontal" role="form" id="login_form">
 	<div class="form-group">
              <label for="uname" class="col-sm-3 control-label">用户名</label>
              <div class="col-sm-8">
               <input type="text"  class="form-control" name="uname" value="" placeholder="用户名" class="reg_user">
              </div>
            </div>
           <div class="form-group">
              <label for="upwd" class="col-sm-3 control-label">密码</label>
              <div class="col-sm-8">
                 <input type="password"  class="form-control"  name="upassword" value="" placeholder="密码" class="reg_password">
              </div>
            </div>
        <button  class="my_btn" onClick="login()">登录</button>
     <div class="form-group has-error">
				<div class="col-sm-offset-2 col-sm-8 col-xs-8 ">
					<span class="help-block">${user_error}</span>
				</div>
			</div>         
    </form>
        </div>
        </div>
        
        
       <% session.removeAttribute("user_error");%> 
        
         <!--footer start-->
   <%@include file="footer.jsp"%>
   <!--footer end-->
   <script src="css/user_css/js/vendor/jquery-1.12.0.min.js"></script>
        <!-- bootstrap js -->
        <script src="css/user_css/js/bootstrap.min.js"></script>
        <!-- owl.carousel js -->
        <script src="css/user_css/js/owl.carousel.min.js"></script>
        <!-- meanmenu js -->
        <script src="css/user_css/js/jquery.meanmenu.js"></script>
        <!-- countdown js -->
        <script src="css/user_css/js/countdown.js"></script>
        <!-- jquery.nivo.slider.pack js -->
        <script src="css/user_css/js/jquery.nivo.slider.pack.js"></script>
        <!-- jquery-ui.min.js -->
        <script src="css/user_css/js/jquery-ui.min.js"></script>
        <!-- wow js -->
        <script src="css/user_css/js/wow.min.js"></script>
        <!-- plugins js -->
        <script src="css/user_css/js/plugins.js"></script>
        <!-- main js -->
        <script src="css/user_css/js/main.js"></script>
        
</body>
</html>